package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.PremisesApiService;
import com.yixun.qfbao.apidto.GetPremisesCityResDto;
import com.yixun.qfbao.constants.OpenApiConstant;
import com.yixun.qfbao.vo.GetPremisesCityReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("getPremisesCityHander")
public class GetPremisesCityHander {
	private static final Logger logger = LoggerFactory.getLogger(GetPremisesCityHander.class);

	@Autowired
	private PremisesApiService premisesApiService;

	public GetPremisesCityResDto hander(GetPremisesCityReqVo reqDto) {
		GetPremisesCityResDto resDTO = new GetPremisesCityResDto();
		try {
			resDTO = premisesApiService.getPremisesCity(reqDto.getParams());
			resDTO.setResponseCode(ResultEnum.SUCCESS.getNo());
		} catch (Exception e) {
			resDTO.setResponseCode(OpenApiConstant.RC_EXCEPTION_ERROR.getResponseCode());
			resDTO.setResponseMessage(e.getMessage());
			logger.error("get premises city hander error: {}", e);
		}
		return resDTO;

	}
}
